package com.zuihai.app.mvp.ui.adapter.three;

import android.view.ViewGroup;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.zuihai.app.R;
import com.zuihai.app.mvp.ui.holder.BaseViewHolderWraper;
import com.zuihai.app.mvp.ui.utils.MyUtils;

import java.util.ArrayList;

/**
 * Created by Administrator on 2017/6/14 0014.
 */

public class ImageAdapter extends BaseQuickAdapter<String, BaseViewHolderWraper> {

    private int mWidth;
    private ArrayList<String> mData=new ArrayList<>();
    public ImageAdapter(ArrayList data,int width) {
        super(R.layout.layout_image,data);
        mData=data;
        this.mWidth=width;
    }

    @Override
    protected void convert(BaseViewHolderWraper helper, String data) {
        ImageView imageView=helper.getView(R.id.iv_imageview);
        ViewGroup.LayoutParams lp = imageView.getLayoutParams();
        lp.height = (int) ((mWidth)/4);
        imageView.setLayoutParams(lp);
       /* ivCover.post(new Runnable() {
            @Override
            public void run() {
                ViewGroup.LayoutParams layoutParams = ivCover.getLayoutParams();
                layoutParams.height = (int) (ivCover.getMeasuredWidth() * 0.5625);
                ivCover.setLayoutParams(layoutParams);
            }
        });*/
        //helper.loadImage169(R.id.iv_cover, item.picture.get(0).url);
        MyUtils.big11Glide(mContext,data,imageView);

    }

}
